import requests

base_url = 'https://www.baidu.com/'
response = requests.get(base_url)

print(response.status_code)

# 在百度搜索python
# 方法一：
base_url = 'https://www.baidu.com/s'
param = 'wd=python'
full_url = base_url + '?' + param        # 问号连接
response = requests.get(full_url)

print(response.status_code)


# 方法二：
base_url = 'https://www.baidu.com/s'
wd_params = {'wd': 'python'}            # 用字典
response = requests.get(base_url, params=wd_params)

print(response.status_code)
